package com.edu.exam.enums.curriculum.questionbank;

/**
 * 关联来源枚举
 * 
 * 试题分类关联的来源定义
 * 
 * @author System
 * @version 1.0.0
 */
public enum AssociationSource {
    MANUAL("MANUAL", "手动关联"),
    AUTO_CLASSIFY("AUTO_CLASSIFY", "自动分类"),
    SYSTEM("SYSTEM", "系统关联"),
    AI("AI", "智能关联"),
    IMPORT("IMPORT", "导入关联"),
    MIGRATION("MIGRATION", "迁移关联");

    private final String code;
    private final String description;

    AssociationSource(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static AssociationSource fromCode(String code) {
        for (AssociationSource source : values()) {
            if (source.getCode().equals(code)) {
                return source;
            }
        }
        return MANUAL;
    }
}